package com.snailct.bpp.service.client.support;

import com.snailct.bpp.commons.protocol.RespResult;
import com.snailct.bpp.commons.utils.SpringContextHolder;
import com.snailct.bpp.router.api.IServiceRouter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

/**
 * spring方式本地调用服务路由，需要把bpp-service-router　jar包放入客户端classpath下
 * @author andy
 */
public class SpringServiceInvoker extends DefaultServiceInvoker {
    protected RespResult request(String reqXml) {
        IServiceRouter serviceRouter = SpringContextHolder.getBean("xmlServiceRouter");
        String respStr = serviceRouter.acceptRequest(reqXml);
        RespResult respResult = new RespResult(RespResult.ReqStatus.OK,respStr);
        return respResult;
    }
}
